<?php
namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB; 
use Illuminate\Support\Facades\Session;

class ProloginController extends Controller
{
    public function index(){
        return view('home/login.prologin');
    }

    public function prologin_do(Request $request){
        //dd($request->all());
        $pro_email = $request->pro_email;

        $password = Hash::make($request->pro_pwd);
        $password = md5($request->pro_pwd.'salt');

        $result = DB::table('property')
        ->where([
            'pro_email' => $pro_email,
            'pro_pwd' => $password,
        ])->first();	

        if($result){
            Session::put('pro_email',$result->pro_email);
            return 1;
        }
    }
}
